import http from '@/utils/request.js'
// import store from '../store'

/**
 *用户认证登录
 * @param {*} mobile
 * @param {*} code
 */
export const reqLogin = (mobile, code) => {
  return http({
    method: 'post',
    url: '/app/v1_0/authorizations',
    data: {
      mobile,
      code
    }
  })
}

/**
 * 获取用户个人资料
 */
export const reqGetProfile = () => {
  return http({
    method: 'get',
    url: '/app/v1_0/user/profile'
  })
}

/**
 * 获取用户自己资料
 */
export const reqGetUserInfo = () => {
  return http({
    method: 'get',
    url: '/app/v1_0/user'
  })
}

/**
 * 修改个人信息
 * @param {*} obj 需要传递的参数 name photo gender birthday
 */
export const reqUpdateInfo = (obj) => {
  return http({
    method: 'patch',
    url: '/app/v1_0/user/profile',
    data: {
      obj
    }
  })
}

/**
 * 上传用户头像
 */
export const reqUpdatePhoto = (formData) => {
  return http({
    method: 'patch',
    url: '/app/v1_0/user/photo',
    data: formData
  })
}
